<template>
  <van-action-sheet
    :show="active === 3"
    destroyOnClose
    :before-close="beforeClose"
  >
    <div class="download-sheet">
      <div class="header">
        <div class="con-box">
          <NuxtImg alt="app icon" src="/images/user/headsculpture_img_0.png" />
          <div>
            <p>{{ lang.download_site_label }}</p>
            <p>
              {{ lang.download_tagline_line1 }}
              {{ lang.download_tagline_line2 }}
            </p>
          </div>
        </div>
      </div>
      <div class="warp">
        <div class="warp1">
          <div class="title">{{ lang.download_title }}</div>
          <div class="con">
            <p>{{ lang.download_paragraph_1 }}</p>
            <p>{{ lang.download_paragraph_2 }}</p>
            <p>{{ lang.download_paragraph_3 }}</p>
            <p>{{ lang.download_paragraph_4 }}</p>
            <p>{{ lang.download_paragraph_5 }}</p>
          </div>
          <div class="jh-box">
            <div class="btn" v-click-move @click="goDownload">
              <NuxtImg src="images/layout/xiazai.png" />{{
                lang.download_cta_text
              }}
            </div>
          </div>
        </div>
        <div class="warp2">
          <div class="title">{{ lang.download_install_title }}</div>
          <div class="con">
            <p>{{ lang.download_step_1 }}</p>
            <p>{{ lang.download_step_2 }}</p>
            <p>{{ lang.download_step_3 }}</p>
          </div>
        </div>
        <div class="warp3">
          <div class="title">{{ lang.download_notice_title }}:</div>
          <p>{{ lang.download_notice_desc }}</p>
        </div>
      </div>
    </div>
  </van-action-sheet>
</template>

<script setup lang="ts">
const lang: any = getCurrentPageLang("init-page");

defineProps(["active"]);

const emit = defineEmits(["close"]);

function beforeClose() {
  emit("close");
}

function goDownload() {
  showNotify({
    type: "success",
    message: "触发下载",
  });
  emit("close");
}
</script>

<style scoped lang="scss">
.el-drawer__body > * {
  box-sizing: border-box;
}
.download-sheet {
  padding-bottom: env(safe-area-inset-bottom);
}
.header {
  padding: 0.6rem 0.45rem;
  border-radius: 0.3rem 0.3rem 0rem 0rem;
  background: linear-gradient(to right, #e150a4 0%, #e670c8 100%);
  color: var(--theme-neutral1);
  position: relative;
}
.header .con-box {
  display: flex;
  gap: 0.4rem;
  font-size: 0.34rem;
  height: 1.6rem;
  box-sizing: border-box;
  font-weight: 100;
  color: #ffd2fd;
}
.header .con-box img {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.3rem;
  display: block;
  object-fit: cover;
}
.header .con-box div {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.1rem 0;
}
.header .con-box p:nth-of-type(1) {
  font-size: 0.46rem;
  font-weight: 600;
  color: var(--theme-neutral1);
}
.warp {
  box-sizing: border-box;
  background: var(--app-bg-color);
  padding: 0.6rem 0.45rem;
  color: var(--theme-neutral1);
  max-height: 70vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.warp .warp1 {
  text-align: center;
}
.warp .warp1 .title {
  font-weight: 600;
  margin-bottom: 0.2rem;
  font-size: 0.44rem;
}
.warp .warp1 .con {
  overflow: visible;
  max-height: none;
  color: #86718c;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.warp .warp1 .con p {
  font-size: 0.3rem;
  line-height: 0.5rem;
  font-weight: 400;
  white-space: pre-wrap;
  color: #86718c;
}
.warp .warp1 .jh-box {
  margin: 0.3rem auto 0;
  height: 1.2rem;
  box-sizing: border-box;
}
.warp .warp1 .jh-box .btn {
  margin: 0 auto;
  width: 90%;
  height: 1.2rem;
  background: linear-gradient(to right, #e151a4 0%, #e66fc8 81%);
  box-sizing: border-box;
  border-radius: 1.2rem;
  font-weight: 700;
  font-family: Microsoft YaHei;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 0.06rem 0.18rem rgba(0, 0, 0, 0.25);
}
.warp .warp1 .jh-box .btn img {
  width: 0.8rem;
  margin-right: 0.3rem;
}
.warp .warp2 {
  margin-top: 0.5rem;
}
.warp .warp2 .title {
  font-weight: 600;
  margin-bottom: 0.1rem;
}
.warp .warp2 p {
  color: #86718c;
  line-height: 0.5rem;
  font-weight: 400;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 0.3rem;
}
.warp .warp3 {
  margin-top: 0.1rem;
  padding: 0.3rem;
  border-radius: 0.2rem;
  background: var(--box-bg-color);
  color: #86718c;
  font-size: 0.3rem;
  .title {
    color: #fff;
    font-size: 0.36rem;
    margin-bottom: 0.1rem;
  }
}
.warp .warp3 div {
  display: flex;
  align-items: center;
  font-weight: 600;
}
.warp .warp3 img {
  width: 0.34rem;
  margin-right: 0.1rem;
}

/* Reset media defaults inside this component for safer layouts */
img {
  max-width: 100%;
  height: auto;
  display: block;
}
</style>
